package com.nn.controller;


import com.nn.pojo.Role;
import com.nn.service.RoleService;
import com.nn.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    /**
     * 业务需求:利用分页展现role列表数据
     * 请求类型:GET
     * url:http://localhost:8091/role/getRoleList
     * 参数:
     * 返回值:SysResult对象
     */
    @GetMapping("/getRoleList")
    public SysResult getRoleList() {
        List<Role> list = roleService.getRoleList();
        return SysResult.success(list);
    }

}
